package com.arsn.myf.flow.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.flowable.ui.common.model.UserRepresentation;
import org.flowable.ui.common.security.DefaultPrivileges;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;

/**
 * 登录用户模拟返回--集成 flow-modeler-ui 需要配置
 * @author zhongrj
 * @date 2022-11-12
 */
@RestController
@RequestMapping("/app")
@Api(value = "用户模拟登录返回",tags = "用户模拟登录返回,集成 flow-modeler-ui 需要配置")
public class RemoteAccountController {

	/**
	 * 用户模拟登录返回
	 */
	@GetMapping("/rest/account")
	@ApiOperation(value = "用户模拟登录返回")
	public UserRepresentation getAccount() {
		UserRepresentation userRepresentation = new UserRepresentation();
		userRepresentation.setFirstName("Myf");
		userRepresentation.setLastName("admin");
		userRepresentation.setFullName("admin");
		userRepresentation.setId("admin");
		List<String> pris = new ArrayList<>();
		pris.add(DefaultPrivileges.ACCESS_MODELER);
		pris.add(DefaultPrivileges.ACCESS_IDM);
		pris.add(DefaultPrivileges.ACCESS_ADMIN);
		pris.add(DefaultPrivileges.ACCESS_TASK);
		pris.add(DefaultPrivileges.ACCESS_REST_API);
		userRepresentation.setPrivileges(pris);
	    //返回
		return userRepresentation;
	}
}
